package com.vim.common.utils;

import com.github.pagehelper.PageInfo;
import com.vim.common.model.response.PageRestfulResponse;

/**
 * 针对API,进行分页数据处理
 */
public class PageRestfulResponseUtils {

    public static PageRestfulResponse handle(PageInfo pageInfo){
        PageRestfulResponse response = new PageRestfulResponse();
        response.setTotalCount(pageInfo.getTotal());
        response.setTotalPage(pageInfo.getPages());
        response.setPageSize(pageInfo.getPageSize());
        response.setCurrentPage(pageInfo.getPageNum());
        response.setData(pageInfo.getList());
        return response;
    }
}
